import axios from 'axios';

let axiosInstance = axios.create({
    baseURL:'/',
    timeout:5000,
})


axiosInstance.interceptors.request.use((config) => { 
		let travel = localStorage.getItem('travel');
		if(travel != null) {
			config.headers.travel = travel;
		}
		return config; 
	}, (error) => {
        return { message : '请求错误' }
    }
);

axiosInstance.interceptors.response.use((success) => { 
		return success.data; 
	}, (error) => { 
		return { message : '响应错误'} 
	}
);

export default axiosInstance;